import request from '../utils/request';

export const getLunbo = () => {
  return request({
    method: 'get',
    url: '/api/getlunbo',
  });
};

export const getGrids = () => {
  return request({
    method: 'get',
    url: '/api/grids',
  });
};

export const getNewslist = () => {
  return request({
    method: 'get',
    url: '/api/getnewslist',
  });
};

export const getNewsinfo = (id) => {
  return request({
    method: 'get',
    url: '/api/getnew/' + id,
  });
};

export const getComments = ({ id, page, limit }) => {
  return request({
    method: 'get',
    url: `/api/getcomments/${id}?pageindex=${page}&limit=${limit}`,
  });
};

export const postComment = (id, content) => {
  return request({
    method: 'post',
    url: '/api/postcomment/' + id,
    data: {
      content,
    },
  });
};

export const getImgcategory = () => {
  return request({
    method: 'get',
    url: '/api/getimgcategory',
  });
};

export const getImages = (id) => {
  return request({
    method: 'get',
    url: '/api/getimages/' + id,
  });
};

export const getimageInfo = (id) => {
  return request({
    method: 'get',
    url: '/api/getimageInfo/' + id,
  });
};

export const getThumImages = (id) => {
  return request({
    method: 'get',
    url: '/api/getthumimages/' + id,
  });
};

export const getGoods = ({ page, limit }) => {
  return request({
    method: 'get',
    url: `/api/getgoods/?pageindex=${page}&limit=${limit}`,
  });
};

export const getDesc = (id) => {
  return request({
    method: 'get',
    url: '/api/goods/getdesc/' + id,
  });
};

export const getInfo = (id) => {
  return request({
    method: 'get',
    url: '/api/goods/getinfo/' + id,
  });
};
